#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define LEN 10
void matrix_init(int a[], int n);
int sum_two_dimensional_array(const int a[][LEN], int n) {
    int i, j, sum = 0;
    for (i = 0; i < n; i++)
        for (j = 0; j < LEN; j++)
            sum += a[i][j];
    return sum;
}
int sum_two_dimensional_array2(const int *a, int n) {
    int sum = 0;
    for (const int *p = a; p < a + n; p++)
        sum += *p;
    return sum;
}
int sum_two_dimensional_array3(const int a[][LEN], int n) {
    int sum = 0;
    for (const int *p = a[0]; p < a[0] + n * LEN; p++)
        sum += *p;
    return sum;
}
int main(void)
{
    int a[10][LEN];
    matrix_init(a[0], 10 * LEN);
    printf("%d\n", sum_two_dimensional_array(a, 10));
    printf("%d\n", sum_two_dimensional_array2(a[0], 10 * LEN));
    printf("%d\n", sum_two_dimensional_array3(a, 10));
    return 0;
}
void matrix_init(int a[], int n) {
    srand((unsigned) time(NULL));
    for (int i = 0; i < n; i++)
        a[i] = rand() % 100;
}